<template>
  <el-input v-bind="$attrs" v-on="$listeners" v-model="asyncValue"></el-input>
</template>

<script>
import {RuleUtils} from "../../utils/RuleUtils";

export default {
  name: "NumberInput",
  model:{
    event:'update:value',
    prop: 'value',
  },
  props:{
    value:{
      type: String,
      default:''
    }
  },
  computed:{
    asyncValue:{
      set(value){
        if(RuleUtils.isNumber(value) === true){
          this.$emit('update:value',value)
        }
        if(value === ''){
          this.$emit('update:value',value)
        }
      },
      get(){
        if(RuleUtils.isNumber(this.value) === true){
          return this.value
        }
        return ''
      }
    }
  }
}
</script>

<style scoped lang="scss">

</style>
